<template>
  <div>
    <div id="topdiv" ref="appdiv" >
      <div class="demoTable" style="padding: 5px;"  v-if="searchIsShow"  >
        <el-form :inline="true" size="mini"   ref="listSearch"   >
          <el-form-item    v-for="(item,index) in listSearch" :style="'display:'+item.isHide" >
            <!--模糊搜索-->
            <template  v-if="item.gs == '' || item.gs=='0' || item.gs=='4' || item.gs == '6'"  >

              <template v-if="item.type == '0'">
                <el-input style="width:180px" v-model="searchInputDtos[item.key].value" :placeholder="item.lable"  clearable @keyup.enter.native="toolsSearch" ></el-input>
              </template>

              <!--下拉框多选-->
              <template v-if="item.type == '6' || item.type=='8'" >
                <el-select  multiple :placeholder="item.lable"
                            filterable style="width:180px"
                            v-model="searchInputDtos[item.key].values"  >
                  <el-option value="" ></el-option>
                  <el-option :value="vm.value"  :label="vm.showValue" v-for="vm in item.searchTypeForSelectDtos">{{vm.showValue}}</el-option>
                </el-select>
              </template>

              <template v-if="item.type == '11'" >
                <el-cascader :placeholder="item.lable" :ref="item.key" size="mini" @change="handleChange(item.key)" clearable
                             v-model="searchInputDtos[item.key].values"  :props="cascaderProps[item.key]"
                ></el-cascader>
              </template>

              <!--日期框-->
              <template v-if="item.type == '1'">
                <el-date-picker value-format="yyyy-MM-dd" :placeholder="item.lable"
                                v-model="searchInputDtos[item.key].value"  style="width:180px"
                                type="date" >
                </el-date-picker>
              </template>

              <!--日期框时分秒-->
              <template v-if="item.type == '5'">
                <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" :placeholder="item.lable"
                                v-model="searchInputDtos[item.key].value"  style="width:180px"
                                type="datetime" >
                </el-date-picker>
              </template>

              <!--日期框年月-->
              <template v-if="item.type == '15'">
                <el-date-picker value-format="yyyyMM" :placeholder="item.lable"
                                v-model="searchInputDtos[item.key].value"  style="width:180px"
                                type="month" >
                </el-date-picker>
              </template>

            </template>

            <!--大于小于输入框-->
            <template  v-if="item.gs=='1'"  >
              <template v-if="item.type == '0'">
                <el-input style="width:180px"  v-model="searchInputDtos[item.key].searchTypeForDateDto.start" :placeholder="'开始'+item.lable"  @keyup.enter.native="toolsSearch" ></el-input>
                <el-input style="width:180px"  v-model="searchInputDtos[item.key].searchTypeForDateDto.end" :placeholder="'结束'+item.lable"  @keyup.enter.native="toolsSearch" ></el-input>
              </template>

              <!--下拉框多选-->
              <template v-if="item.type == '6' || item.type=='8'" >
                <el-select filterable style="width:180px" :placeholder="'开始'+item.lable"
                           v-model="searchInputDtos[item.key].searchTypeForDateDto.start" >
                  <el-option value="" ></el-option>
                  <el-option :value="vm.value" :label="vm.showValue" v-for="vm in item.searchTypeForSelectDtos">{{vm.showValue}}</el-option>
                </el-select>

                <el-select  filterable style="width:180px" :placeholder="'结束'+item.lable"
                            v-model="searchInputDtos[item.key].searchTypeForDateDto.end" >
                  <el-option value="" ></el-option>
                  <el-option :value="vm.value" :label="vm.showValue" v-for="vm in item.searchTypeForSelectDtos">{{vm.showValue}}</el-option>
                </el-select>
              </template>

              <template v-if="item.type == '11'" >
                <el-cascader  :ref="item.key" size="mini" @change="handleChange(item.key)" clearable :placeholder="'开始'+item.lable"
                              v-model="searchInputDtos[item.key].searchTypeForDateDto.start" :props="cascaderProps[item.key]"
                ></el-cascader>
                <el-cascader  :ref="item.key" size="mini" @change="handleChange(item.key)" clearable :placeholder="'结束'+item.lable"
                              v-model="searchInputDtos[item.key].searchTypeForDateDto.end" :props="cascaderProps[item.key]"
                ></el-cascader>
              </template>

              <!--日期框-->
              <template v-if="item.type == '1'">
                <el-date-picker value-format="yyyy-MM-dd"  :placeholder="'开始'+item.lable"
                                v-model="searchInputDtos[item.key].searchTypeForDateDto.start" style="width:180px"
                                type="date" >
                </el-date-picker>
                <el-date-picker value-format="yyyy-MM-dd" :placeholder="'结束'+item.lable"
                                v-model="searchInputDtos[item.key].searchTypeForDateDto.end" style="width:180px"
                                type="date" >
                </el-date-picker>
              </template>

              <!--日期框时分秒-->
              <template v-if="item.type == '5'">
                <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" :placeholder="'开始'+item.lable"
                                v-model="searchInputDtos[item.key].searchTypeForDateDto.start" style="width:180px"
                                type="datetime" >
                </el-date-picker>
                <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" :placeholder="'结束'+item.lable"
                                v-model="searchInputDtos[item.key].searchTypeForDateDto.end" style="width:180px"
                                type="datetime" >
                </el-date-picker>
              </template>


              <!--日期框年月-->
              <template v-if="item.type == '15'">
                <el-date-picker value-format="yyyyMM" :placeholder="'开始'+item.lable"
                                v-model="searchInputDtos[item.key].searchTypeForDateDto.start" style="width:180px"
                                type="month" >
                </el-date-picker>
                <el-date-picker value-format="yyyyMM" :placeholder="'结束'+item.lable"
                                v-model="searchInputDtos[item.key].searchTypeForDateDto.end" style="width:180px"
                                type="month" >
                </el-date-picker>
              </template>

            </template>

            <!--大于条件-->
            <template  v-if="item.gs=='2'"  >
              <template v-if="item.type == '0'">
                <el-input style="width:180px"  v-model="searchInputDtos[item.key].searchTypeForDateDto.start" :placeholder="item.lable"  ></el-input>
              </template>

              <!--下拉框多选-->
              <template v-if="item.type == '6' || item.type=='8'" >
                <el-select filterable style="width:180px"  :placeholder="item.lable"
                           v-model="searchInputDtos[item.key].searchTypeForDateDto.start" >
                  <el-option value="" ></el-option>
                  <el-option :value="vm.value" :label="vm.showValue" v-for="vm in item.searchTypeForSelectDtos">{{vm.showValue}}</el-option>
                </el-select>
              </template>

              <template v-if="item.type == '11'" >
                <el-cascader  :ref="item.key" size="mini" @change="handleChange(item.key)" clearable  :placeholder="item.lable"
                              v-model="searchInputDtos[item.key].searchTypeForDateDto.start" :props="cascaderProps[item.key]"
                ></el-cascader>
              </template>

              <!--日期框-->
              <template v-if="item.type == '1'">
                <el-date-picker value-format="yyyy-MM-dd"  :placeholder="item.lable"
                                v-model="searchInputDtos[item.key].searchTypeForDateDto.start" style="width:180px"
                                type="date" >
                </el-date-picker>
              </template>

              <!--日期框时分秒-->
              <template v-if="item.type == '5'">
                <el-date-picker value-format="yyyy-MM-dd HH:mm:ss"  :placeholder="item.lable"
                                v-model="searchInputDtos[item.key].searchTypeForDateDto.start" style="width:180px"
                                type="datetime" >
                </el-date-picker>
              </template>

              <!--日期框年月-->
              <template v-if="item.type == '15'">
                <el-date-picker value-format="yyyyMM"  :placeholder="item.lable"
                                v-model="searchInputDtos[item.key].searchTypeForDateDto.start" style="width:180px"
                                type="month" >
                </el-date-picker>
              </template>

            </template>

            <!--小于条件-->
            <template  v-if="item.gs=='3'"  >
              <template v-if="item.type == '0'">
                <el-input style="width:180px"  v-model="searchInputDtos[item.key].searchTypeForDateDto.end"  :placeholder="item.lable"  ></el-input>
              </template>

              <!--下拉框多选-->
              <template v-if="item.type == '6' || item.type=='8'" >

                <el-select  filterable style="width:180px"
                            v-model="searchInputDtos[item.key].searchTypeForDateDto.end"  :placeholder="item.lable" >
                  <el-option value="" ></el-option>
                  <el-option :value="vm.value"  :label="vm.showValue" v-for="vm in item.searchTypeForSelectDtos">{{vm.showValue}}</el-option>
                </el-select>
              </template>

              <template v-if="item.type == '11'" >
                <el-cascader  :ref="item.key" size="mini" @change="handleChange(item.key)" clearable  :placeholder="item.lable"
                              v-model="searchInputDtos[item.key].searchTypeForDateDto.end" :props="cascaderProps[item.key]"
                ></el-cascader>
              </template>

              <!--日期框-->
              <template v-if="item.type == '1'">
                <el-date-picker value-format="yyyy-MM-dd"  :placeholder="item.lable"
                                v-model="searchInputDtos[item.key].searchTypeForDateDto.end" style="width:180px"
                                type="date" >
                </el-date-picker>
              </template>

              <!--日期框时分秒-->
              <template v-if="item.type == '5'">
                <el-date-picker value-format="yyyy-MM-dd HH:mm:ss"  :placeholder="item.lable"
                                v-model="searchInputDtos[item.key].searchTypeForDateDto.end" style="width:180px"
                                type="datetime" >
                </el-date-picker>
              </template>

              <!--日期框年月-->
              <template v-if="item.type == '15'">
                <el-date-picker value-format="yyyyMM"  :placeholder="item.lable"
                                v-model="searchInputDtos[item.key].searchTypeForDateDto.end" style="width:180px"
                                type="month" >
                </el-date-picker>
              </template>

            </template>

          </el-form-item>

          <el-form-item v-if="JSON.stringify(listSearch) != '{}' "  >
            <span class="layui-btn" v-if="searchIsShow" @click="toolsSearch()">搜索</span>
            <span class="layui-btn" v-if="searchIsShow" @click="f_search_advanced()">高级检索</span>
            <span class="layui-btn" v-if="searchIsShow" @click="f_search_custom()">自定义搜索</span>
            <span v-if="searchIsShow" class="layui-btn"  @click="searchShowHide()">收起</span>

          </el-form-item>
        </el-form>
      </div>
      <!-- 分割线-->
      <el-divider  v-if="searchIsShow && Object.keys(listSearch).length > 0" style="margin: 3px 0;"  ></el-divider>
      <el-row style="margin-bottom: 4px;" >
        <template v-for="item in buttons"  >
          <template v-if="!item.custom">
            <el-button type="primary" style="margin-left: 1px;" v-if="item.type == 0" :item="JSON.stringify(item)" size="small" :icon="item.icon_path"  @click="f_add(item)">{{item.name}}</el-button>
            <el-button type="primary" style="margin-left: 1px;" v-if="item.type == 1" :item="JSON.stringify(item)"  size="small" :icon="item.icon_path" up=true   @click="f_update(item)">{{item.name}}</el-button>
            <el-button type="primary" style="margin-left: 1px;" v-if="item.type == 2" :item="JSON.stringify(item)" size="small"  :icon="item.icon_path"  @click="f_delete(item)">{{item.name}}</el-button>
            <el-button type="primary" style="margin-left: 1px;" v-if="item.type == 3" :item="JSON.stringify(item)" size="small"  :icon="item.icon_path"  @click="f_post_confirm(item)">{{item.name}}</el-button>
            <el-button type="primary" style="margin-left: 1px;"  v-if="item.type == 4" :icon="item.icon_path" size="small"   @click="f_set_list()">列表自定义</el-button>
            <el-button type="primary" style="margin-left: 1px;"  v-if="item.type == 5" :icon="item.icon_path"  size="small"  @click="f_set_input()">录入自定义</el-button>
            <el-button type="primary"  style="margin-left: 1px;" v-if="item.type == 6" :icon="item.icon_path"  size="small"  @click="f_set_order()">排序自定义</el-button>
            <el-button type="primary"  style="margin-left: 1px;" v-if="item.type == 7" :icon="item.icon_path" size="small"  :item="JSON.stringify(item)"  @click="f_exp(item)">{{item.name}}</el-button>
            <el-button type="primary"  style="margin-left: 1px;" v-if="item.type == 8" :icon="item.icon_path" size="small"  :item="JSON.stringify(item)"  @click="exportLocal(item)">{{item.name}}</el-button>
            <el-button type="primary"  style="margin-left: 1px;" v-if="item.type == 10" :icon="item.icon_path" size="small"  :item="JSON.stringify(item)"  @click="f_imp_excel(item)">{{item.name}}</el-button>
            <el-button type="primary"  style="margin-left: 1px;" v-if="item.type == 11" :icon="item.icon_path" size="small"  :item="JSON.stringify(item)"  @click="f_exp_duibidata_excel(item)">{{item.name}}</el-button>
            <el-button type="primary"  style="margin-left: 1px;" v-if="item.type == 12" :icon="item.icon_path" size="small"  :item="JSON.stringify(item)"  @click="f_bat_update_replace(item)">{{item.name}}</el-button>
            <el-button type="primary"  style="margin-left: 1px;" v-if="item.type == 13" :icon="item.icon_path" size="small"  :item="JSON.stringify(item)"  @click="f_save_list_data(item)">{{item.name}}</el-button>
            <el-button type="primary"  style="margin-left: 1px;" v-if="item.type == 14" :icon="item.icon_path" size="small"  :item="JSON.stringify(item)"  @click="f_ClearData(item)">{{item.name}}</el-button>
            <el-button type="primary"  style="margin-left: 1px;" v-if="item.type == 15" :icon="item.icon_path" size="small"  :item="JSON.stringify(item)"  @click="f_imp_excel_sheet_mulit(item)">{{item.name}}</el-button>


          </template>

          <template v-if="item.custom" >
            <el-button type="primary" :icon="item.icon_path" style="margin-left: 1px;"  :item="JSON.stringify(item)" size="small"    @click="callFunModule(item.custom_data_zygl_id)"  >{{item.name}}</el-button>
          </template>

        </template>

        <el-button v-if="!searchIsShow" style="margin-left: 0px;"  icon="el-icon-search" type="primary" size="small" @click="searchShowHide()">搜索</el-button>

      </el-row>
    </div>

    <!-- 列表显示开始   -->
    <div>
      <el-table
          :data="tableData"
          ref="tipsTable"
          size="mini"
          :summary-method="getSummaries"
          :show-summary="showSummary"
          :height="tableHeight"
          @selection-change="handleSelectionChange"
          @row-click="rowClick"
          @sort-change="sortChange"
          :row-style="rowClass"
          @cell-dblclick="cellDblclick"
          border
          style="width: 100%;background: #ecf5ff;">
        <el-table-column
            type="selection"
            width="55">
        </el-table-column>

        <!--关联子表列表显示-->
        <template v-if="mapzygl.children_table == '1'" >
          <el-table-column type="expand"  >
            <template slot-scope="props">
              <div>
                <iframe :src="mapzygl.children_zygl_id.list_url+'pid='+props.row[mapzygl.main_re_col_name]+'&main_re_col_name='+mapzygl.main_re_col_name+'&children_re_col_name='+mapzygl.children_re_col_name+'&data='+new Base64().encode(JSON.stringify(props.row))" frameborder="0" width="100%" :height="mapzygl.children_zygl_id.Input_height"></iframe>
              </div>
            </template>
          </el-table-column>
        </template>


        <el-table-column v-for="(item,index) in listColumn"
                         :prop="item.field"
                         :label="item.title"
                         sortable="custom"
                         :show-overflow-tooltip="true"
                         :width="item.minWidth" >
          <template  slot-scope="scope">
            <!--图片显示-->
            <template  v-if="item.col_style!=undefined && item.col_style == '4' && scope.row[item.field]!='' " >
              <template  style='margin: 0 5px;' v-for="(src,index1) in scope.row[item.field].split(',')" >
                <img :src="src" :alt="src" :title="src"  width="30px" height="30px" @click="window.open(src)" />
              </template>
              <a style="color: blue;cursor: pointer;" @click="openImageurl(scope.row[item.field])" v-if="scope.row[item.field].split(',').length>1" >查看全部</a>
            </template>

            <!--文件下载-->
            <template  v-if="item.col_style!=undefined && item.col_style == '22' && scope.row[item.field]!='' " >
              <template  style='margin: 0 5px;' v-for="(src,index1) in scope.row[item.field].split(',')" >
                <a style="display: block;color: blue;cursor: pointer;" target="_blank" :href="src">{{src}}</a>
              </template>
              <a style="color: blue;cursor: pointer;" @click="openImageurl(scope.row[item.field])" v-if="scope.row[item.field].split(',').length>1" >查看全部</a>
            </template>

            <!--列表输入框进行编辑-->
            <template v-if="item.is_list_edit == '0'" >
              <!--远程搜索下拉框-->
              <el-select
                  @change="saveListDataInput(scope.row)"
                         :remote-method="(query) => remoteMethod(query,item)"
                         remote  size="mini"
                         v-if="item.col_style == 16" filterable :style="'width:'+item.input_width"
                         v-model="scope.row[item.field]" :placeholder="item.show_name" >
                <el-option value="" ></el-option>
                <el-option v-for="option in item.options" :label="option.value" :value="option.key"></el-option>
              </el-select>

              <el-input  size="mini"  @blur="saveListDataInput(scope.row)" v-model="scope.row[item.field]" v-if="item.col_style != '16'"  ></el-input>

            </template>

            <template v-else  >
              <template v-for="(itembutton,indexbutton) in buttons_rows" >

                <template v-if="item.field == itembutton.is_input">
                  <el-button type="text" v-if="!itembutton.custom"  @click="click_button_rows(itembutton.type,scope.row,itembutton)"   size="small">{{scope.row[item.field]}}</el-button>
                  <el-button type="text" v-if="itembutton.custom" size="small"    @click="click_button_rows('custom',scope.row,itembutton)"  >{{scope.row[item.field]}}</el-button>
                </template>

              </template>

              <el-popover
                  placement="top-start"
                  width="300" v-if="item.col_style != '4' && item.col_style != '22'"
                  trigger="click" >

                <div style="color:#800000">
                  <template v-if="item.is_button != '1'" >
                    <div v-html="scope.row[item.field]" ></div>
                  </template>
                </div>
                <span slot="reference" v-if="item.is_button != '1'"><div v-html="scope.row[item.field]"></div></span>
              </el-popover>
            </template>
          </template>

        </el-table-column>


        <el-table-column
            v-if="buttons_rows_len > 0"
            fixed="right"
            label="操作"
            :width="buttons_rows_len">
          <template slot-scope="scope">
            <template v-for="(item,index) in buttons_rows" >
              <el-button type="text" v-if="!item.custom"  @click="click_button_rows(item.type,scope.row,item)"   size="small">{{item.name}}</el-button>

              <el-button type="text" v-if="item.custom" size="small"    @click="click_button_rows('custom',scope.row,item)"  >{{item.name}}</el-button>
            </template>
          </template>
        </el-table-column>


      </el-table>

      <el-pagination
          background
          @current-change="handleCurrentChange"
          @size-change="sizeChange"
          layout="prev, pager, next,total,sizes"
          :total="total"
          :page-size="pageSize"
          :page-sizes="pageSizes"
      >
      </el-pagination>
    </div>
  </div>




</template>

<script>
let _this = {};
module.exports = {
  name: "listCommon",
  props: ["tableid"],
  data() {
    return {
      tableId:top.data.tableId,
      listSearch: {}//默认查询的字段
      , searchInputDtos: {},
      buttons: [],
      buttons_rows:[],
      buttons_rows_len:0,
      mapzygl:{},
      listColumn:[],
      tableData: [],
      multipleSelection: [],
      selectData: [],//选择的数据集合
      cascaderProps:{},//三级联动动态加载
      parmsData:{},
      keycode:"",
      tableHeight:0,
      updateButtonItem:{},//修改按钮上面的item属性值
      //选择行变颜色参数
      chooseArr:[],
      selectRow: [],
      orderBy:"",
      //分页参数
      pageNumber:1,
      total:0,
      pageCount:0,
      pageSize:15,
      pageSizes:[10,15,20,50,100,200,500],
      //尾部是否显示合计
      showSummary:false,
      //尾部统计数据容器
      sums:["","合计："],
      //搜索栏是否显示
      searchIsShow:true,
    };
  },
  created() {
    _this = this;
    _this.parmsData = getParams();
    if(_this.parmsData.tableId != undefined){
      _this.tableId = getTableId(_this.parmsData.tableId);
      top.data.zygl_id = _this.tableId;
      top.data.tableId = _this.tableId;
    }

    let userstr = localStorage.getItem("user");
    if(userstr!=undefined && userstr!=""){
      let user = JSON.parse(userstr);
      let keycode = user.org_id;
      if(keycode!=undefined && keycode!=""){
        _this.keycode = keycode;
      }
    }
    _this.getHead();
  },

  methods:{
    getSelectData(){
      return this.selectData;
    },
    callFunModule(methodName){
      _this.$parent[methodName]();
    },
    callFunModuleRow(methodName,row){
      _this.$parent[methodName](row);
    },
    getSummaries(param){
      return _this.sums;
    },
    async saveListDataInput(row){
      const res = await postBody("/admin/api/DataManagementController/getButtonForTableColumn",{tableId:this.tableId});
      if(res.code == 1){
        _this.selectData = [row];
        _this.f_save_list_data_table(res.data);
      }
    },
    //远程搜索下拉框
    async remoteMethod(query,field){
      console.log(field)
      const res = await postBody("/admin/api/DataManagementController/DropdownBoxRemoteSearchEvent2",{fieldId:field.id,key:query});
      if(res.code == 0){
        top.error(res.msg);
        return;
      }
      Vue.set(field,"options",res.data)

    },
    //搜索栏显示与展开
    searchShowHide(){
      if(_this.searchIsShow){
        _this.searchIsShow = false;
      }else {
        _this.searchIsShow = true;
      }
      _this.$nextTick(function (){
        //设置表格的高度
        _this.setTableHeight();
      })

    },
    //批量修改与替换
    f_bat_update_replace(item){
      let btn = {
        btn: ['确定', '取消']
        , yes: async function (index, layero) {
          //按钮【按钮一】的回调
          let win = getTopIframe(layero);
          let columns = win.vm.columns;
          let i = top.load();
          const res = await postBody("/admin/api/DataManagementController/BatchModifyReplaceOperationEvent2",{searchInputs:JSON.stringify(_this.searchInputDtos),tableId:item.custom_data_zygl_id,list:columns,ids:""+_this.multipleSelection});
          top.close(i);
          top.alert(res.msg);
        }
        , btn2: function (index, layero) {
          //按钮【按钮二】的回调
          //return false 开启该代码可禁止点击该按钮关闭
        }
      };

      top.f_layer_open_get("/admin/html/dataManagement/batup_update_replace.html?tableId="+item.custom_data_zygl_id, "65%", "80%", function () {

      }, btn, "批量修改与替换");
    },
    //对比数据提取
    async f_exp_duibidata_excel(item){
      let btn = {
        btn: ['提取数据', '取消']
        , yes: function (index, layero) {
          //按钮【按钮一】的回调
          let win = getTopIframe(layero);
          let data = win.vm.startImport();
        }
        , btn2: function (index, layero) {
          //按钮【按钮二】的回调
          //return false 开启该代码可禁止点击该按钮关闭
        }
      };

      top.f_layer_open_get("/admin/html/dataManagement/exp_duibi_data.html?tableId="+this.tableId, "85%", "80%", function () {

      }, btn, "对比数据提取");
    },

    //数据导入-多sheet导入
    async f_imp_excel_sheet_mulit(item) {
      let btn = {
        btn: ['关闭'],
        btn2: function(index, layero) {
          //按钮【按钮二】的回调
          //return false 开启该代码可禁止点击该按钮关闭
        }
      };

      top.f_layer_open_get("/admin/html/dataManagement/import_data.html?tableId=" + this.tableId,
          "85%", "80%",
          function() {

          }, btn, "多工作表数据导入")
    },

    //数据导入
    async f_imp_excel(item){
      let btn = {
        btn: ['导入', '取消']
        , yes: function (index, layero) {
          //按钮【按钮一】的回调
          let win = getTopIframe(layero);
          let data = win.vm.startImport();
        }
        , btn2: function (index, layero) {
          //按钮【按钮二】的回调
          //return false 开启该代码可禁止点击该按钮关闭
        }
      };

      top.f_layer_open_get("/admin/html/columnManagement/import_data.html?tableId="+this.tableId, "85%", "80%", function () {

      }, btn, "数据导入")
    },
    //表尾合计统计
    async getSummariesData(){
      let listother = {};
      copy(top.data.treeNodeObj,listother);
      if(undefined != top.data.param){
        copy({ids:top.data.param.ids},listother);
      }
      listother["parentData"] = _this.getParentData();
      let parm = {
        orderBy: _this.orderBy,
        tableId: _this.tableId,
        searchInputDtos: _this.searchInputDtos,
        other: listother,
        pageNumber:""+_this.pageNumber,
        pageSize : ""+_this.pageSize
      }
      const res = await postBody("/admin/api/DataManagementController/showSummaryMethod",parm);
      if(res.code == 0){
        _this.sums = [""," "];
        //设置表格的高度
        _this.showSummary = false;
        _this.setTableHeight(_this.parmsData.tableHeight);
        return;
      }
      if(res.data == undefined || Object.keys(res.data).length == 0){
        _this.showSummary = false;
        _this.sums = [""," "];
        //设置表格的高度
        _this.showSummary = false;
        _this.setTableHeight(_this.parmsData.tableHeight);
        return;
      }
      let columnSum = [""];
      let ki = 1;
      if(_this.mapzygl.children_table == "1"){
        ki = 2;
      }
      let mapkeys = Object.keys(res.data);
      for(let a=0;a<_this.listColumn.length;a++){
        columnSum[a+ki] = "";
        let column = _this.listColumn[a];
        for(let c=0;c<mapkeys.length;c++){
          if(column.field == mapkeys[c]){
            columnSum[a+ki] = res.data[mapkeys[c]];
          }
        }
      }
      _this.showSummary = true;
      for(let a=0;a<columnSum.length;a++){
        Vue.set(_this.sums,a,columnSum[a]);
      }

    },
    //JS导出当前表格数据
    exportLocal(){
      // 列标题
      let str = '<tr>';
      for(let a=0;a<_this.listColumn.length;a++){
        str = str+"<td>"+_this.listColumn[a].title+"</td>";
      }
      str = str+"</tr>";

      // 循环遍历，每行加入tr标签，每个单元格加td标签
      for(let i = 0 ; i < _this.tableData.length ; i++ ){
        str+='<tr>';
        for(let a=0;a<_this.listColumn.length;a++){
          let field = _this.listColumn[a].field;
          let value = _this.tableData[i][field];
          // 增加\t为了不让表格显示科学计数法或者其他格式
          if(value == undefined){
            value = "";
          }
          str+=`<td style='mso-number-format:"\\@";' >${ value + '\t'}</td>`;
        }
        str+='</tr>';
      }
      // Worksheet名
      const worksheet = 'Sheet1'
      const uri = 'data:application/vnd.ms-excel;base64,';

      // 输出base64编码
      const base64 = s => window.btoa(unescape(encodeURIComponent(s)));

      // 下载的表格模板数据
      const template = `<html xmlns:o="urn:schemas-microsoft-com:office:office"
                    xmlns:x="urn:schemas-microsoft-com:office:excel"
                    xmlns="http://www.w3.org/TR/REC-html40">
                    <head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet>
                    <x:Name>${worksheet}</x:Name>
                    <x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet>
                    </x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->
                    </head><body><table>${str}</table></body></html>`;
      // 下载模板
      window.location.href = uri + base64(template);
    },
    isImageType(str) {
      return "'png', 'jpg','jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'".indexOf(str.toLowerCase()) != -1
    },
    houzhui(url){
      let index = url.lastIndexOf('.') // 获取指定字符串最后一次出现的位置，返回index
      let str = url.substr(index + 1) // substr(start, length) 抽取从start下标开始的length个字符，返回新的字符串
      let hzm = str;
      if(this.isImageType(hzm)){
        return true;
      }else {
        return false;
      }
    },
    //查看图片
    openImageurl(url){
      let openurl = "/admin/html/dataManagement/img_show.html?img="+url;
      top.f_layer_open_get(openurl,'80%','70%','',null,'图片查看',null);

    },
    //自定义排序
    sortChange(column){
      if(column.order == "ascending"){
        _this.orderBy = column.prop+" asc ";
      }else if(column.order == "descending"){
        _this.orderBy = column.prop+" desc ";
      }
      _this.getListdata();
    },
    //当单元格被双击时触发
    cellDblclick(cell){
      let keyids = _this.mapzygl.key_name;
      if(Object.keys(_this.updateButtonItem).length == 0){
        _this.f_view(cell[keyids]);
      }else {
        _this.f_upex(_this.updateButtonItem,cell[keyids]);
      }
    },
    //每页记录数改变
    sizeChange(val){
      _this.pageSize = val;
      _this.getListdata();
    },
    //开始翻页
    handleCurrentChange(val){
      _this.pageNumber = val;
      _this.getListdata();
    },
    // 点击表格行
    rowClick(row) {
      _this.$refs.tipsTable.toggleRowSelection(row);
    },
    // 多选高亮选中行
    rowClass({row, rowIndex}){
      if(_this.selectRow.includes(rowIndex)){
        return { "background-color": "#5aabff" }
      }
    },
    async toolsSearch(){
      let i = load();
      let other = _this.searchInputDtos;
      const res = await postBody("/admin/api/DataManagementController/getCustomFields", {tableId: _this.tableId,mapdata:top.data.treeNodeObj,other:other});
      layer.close(i);
      _this.listColumn = res.data.listColumn;
      _this.pageNumber = "1";
      _this.getListdata();
    },
    //行内按钮点击后执行
    click_button_rows(type,rows,item){
      let vmvalue = "";
      let keyids = _this.mapzygl.key_name.split(",");
      for(let i=0;i<keyids.length;i++){
        if(i == keyids.length-1){
          vmvalue = vmvalue+rows[keyids[i]];
        }else {
          vmvalue = vmvalue+rows[keyids[i]]+"/";
        }
      }
      if(type == "1"){//修改
        _this.f_upex(item,vmvalue);
      }else if(type == "2"){//删除
        _this.f_delete_rows(item,vmvalue);
      }else if(type == "3"){//自定义
        _this.f_post_confirm_rows(item,vmvalue);
      }else if(type == "custom"){//自定义方法接口
        _this.multipleSelection = [vmvalue];
        _this.callFunModuleRow(item.custom_data_zygl_id,rows);
      }else if(type == "9"){//查看详情
        _this.f_view(vmvalue,item);
      }
    },
    handleSelectionChange(val) {
      _this.chooseArr = val;
      _this.multipleSelection = [];
      _this.selectData = [];
      for(let a=0;a<val.length;a++){
        try {
          _this.selectData.push(val[a]);
          let vmvalue = "";
          let keyids = _this.mapzygl.key_name.split(",");
          for(let i=0;i<keyids.length;i++){
            if(i == keyids.length-1){
              vmvalue = vmvalue+val[a][keyids[i]];
            }else {
              vmvalue = vmvalue+val[a][keyids[i]]+"/";
            }
          }
          _this.multipleSelection.push(vmvalue);
        }catch (e){}
      }
      this.$parent.selectData = this.selectData;
      this.$parent.multipleSelection = this.multipleSelection;
    },
    async getHead(){
      let other = {};
      if(top.data.other != undefined && top.data.other != null){
        other = top.data.other;
      }
      other["parentData"] = window.parent.vm.formInline;
      const res = await postBody("/admin/api/DataManagementController/getCustomFields", {tableId: _this.tableId,mapdata:top.data.treeNodeObj,other:other});
      _this.listColumn = res.data.listColumn;
      _this.listSearch = res.data.listSearch;
      _this.searchInputDtos = res.data.listSearch;
      _this.mapzygl = res.data.mapzygl;


      //设置按钮
      _this.buttons = res.data.buttons;
      _this.buttons_rows = res.data.buttons_rows;
      _this.buttons_rows_len = res.data.buttons_rows_len;
      for(let a=0;a<_this.buttons.length;a++){
        let btn = _this.buttons[a];
        if(btn.type == "1"){
          _this.updateButtonItem = btn;
          break;
        }
      }
      //动态加载三级联动
      for(let itemKey in _this.listSearch){
        let itemDto = _this.listSearch[itemKey];
        if(itemDto.type == "11"){
          _this.cascaderProps[itemDto.key] = {//三级联动动态加载
            lazy: true,
            checkStrictly : true,
            async lazyLoad (node, resolve){
              console.log("node:",node);
              let pid = "0000";
              if(node.level != '0'){
                pid = node.data.value;
              }
              const res = await listAdmin(itemDto.data_zygl_id,"id",{pid:pid});
              let nodes = [];
              let nodesList = res.data;
              for(let c=0;c<nodesList.length;c++){
                nodes.push({value:nodesList[c][itemDto.select_v],label:nodesList[c][itemDto.select_text],level:1});
              }

              resolve(nodes);
            }
          }
        }
      }

      //头部渲染完成后，开始设置表格的高度
      _this.$nextTick(function (){
        //表尾是否显示合计
        _this.showSummary = true;
        //设置表格的高度
        _this.setTableHeight(_this.parmsData.tableHeight);

      });

      //列表默认查询参数
      if(_this.parmsData.query != "0"){
        _this.getListdata();
      }

    },
    setTableHeight(h){
      if(h == undefined){
        //设置表格的高度
        if(_this.mapzygl.children_table == "1"){
          _this.tableHeight = parseInt(document.documentElement.scrollHeight)-$("#topdiv").height()-55;
        }else {
          _this.tableHeight = parseInt(document.documentElement.scrollHeight)-$("#topdiv").height()-40;
        }
      }else {
        //设置表格的高度
        _this.tableHeight = h;
      }

    },
    async getListdata(){
      let listother = {};
      try {
        copy(top.data.treeNodeObj,listother);
        if(undefined != top.data.param){
          copy({ids:top.data.param.ids},listother);
        }
        listother["parentData"] = window.parent.vm.formInline;
        listother["other"] = window.parent.vm.other;
        listother["parmsData"] = _this.parmsData;
      }catch (e){}
      top.data.listother = listother;
      let parm = {
        orderBy: _this.orderBy,
        tableId: _this.tableId,
        searchInputDtos: _this.searchInputDtos,
        other: listother,
        pageNumber:""+_this.pageNumber,
        pageSize : ""+_this.pageSize
      }
      let i = load();
      const res = await postBody("/admin/api/DataManagementController/list",parm);
      layer.close(i);
      if(res.code == 0){
        top.error(res.msg);
        return;
      }
      _this.tableData = res.data.rows;
      this.$parent.tableData = this.tableData;
      _this.total = parseInt(res.data.total);
      _this.pageSize = parseInt(res.data.pageSize);
      _this.pageCount = parseInt(res.data.pageCount);

      //表尾统计
      window.setTimeout(function (){
        _this.getSummariesData();
      },500);

    },
    f_search_advanced() {
      let btn = {
        btn: ['确定', '取消']
        , yes: function (index, layero) {
          //按钮【按钮一】的回调
          let win = getTopIframe(layero);
          let data = win.getData();
          top.close(index);
          _this.searchInputDtos = data;
          _this.getListdata();
        }
        , btn2: function (index, layero) {
          //按钮【按钮二】的回调
          //return false 开启该代码可禁止点击该按钮关闭
        }
      };

      top.f_layer_open_get("/admin/html/dataManagement/advancedRetrieval.html?tableId="+this.tableId, "40%", "60%", function () {

      }, btn, "高级检索")
    },
    f_set_list() {
      let btn = {
        btn: ['关闭']
        , btn2: function (index, layero) {
          //按钮【按钮二】的回调
          //return false 开启该代码可禁止点击该按钮关闭
        }
      };
      top.data.custom = "IS_LIST";
      top.f_layer_open_get("/admin/html/dataManagement/custom_list.html", "80%", "65%", function () {

      }, btn, "列表自定义")
    },
    f_set_order(){
      let btn = {
        btn: ['保存','关闭'],
        yes: function (index, layero){
          var win = getTopIframe(layero);
          let data = win.getData();
          let i = top.layer.load();
          postBody("/admin/api/SortCustomManagementController/saveCustomSortData", {list:data}, function (res) {
            top.layer.close(i);
            top.alert(res.msg);
            _this.getListdata();
          })
        }
        , btn2: function (index, layero) {
          //按钮【按钮二】的回调
          //return false 开启该代码可禁止点击该按钮关闭
        }
      };
      top.f_layer_open_get("/admin/html/dataManagement/custom_order.html?tableId="+this.tableId, "60%", "65%", function () {

      }, btn, "排序自定义")
    },
    f_set_input() {
      let btn = {
        btn: ['关闭']
        , btn2: function (index, layero) {
          //按钮【按钮二】的回调
          //return false 开启该代码可禁止点击该按钮关闭
        }
      };
      top.data.custom = "IS_INPUT";
      top.f_layer_open_get("/admin/html/dataManagement/custom_search.html?tableId="+this.tableId, "80%", "65%", function () {

      }, btn, "录入自定义")
    },
    f_search_custom() {
      let btn = {
        btn: ['关闭']
        , btn2: function (index, layero) {
          //按钮【按钮二】的回调
          //return false 开启该代码可禁止点击该按钮关闭
        }
      };
      top.data.custom = "IS_SEARCH";
      top.f_layer_open_get("/admin/html/dataManagement/custom_search.html?tableId="+this.tableId, "80%", "65%", function () {
        _this.getHead();
      }, btn, "自定义搜索")
    },
    async f_exp(item){
      let btn = {
        btn: ['导出','关闭']
        , yes: async function (index, layero) {
          var win = getTopIframe(layero);
          let column_selects = win.vm.column_selects;
          let selectCols = [];
          let cs = Object.keys(column_selects);
          for(let a=0;a<cs.length;a++){
            console.log(cs[a])
            if(column_selects[cs[a]]){
              selectCols.push(cs[a]);
            }
          }
          if(selectCols.length == 0){
            top.error("请至少选择一个字段进行导出！");
            return;
          }

          let i = top.load();
          let listother = {selectCols:selectCols};
          try {
            copy(top.data.treeNodeObj,listother);
            if(undefined != top.data.param){
              copy({ids:top.data.param.ids},listother);
            }
          }catch (e){}
          top.data.listother = listother;
          const res = await postBody("/admin/api/DataManagementController/expExcel",{searchInputDtos:_this.searchInputDtos,tableId:item.custom_data_zygl_id,other:listother});
          top.layer.close(i);
          top.alert(res.msg);
          win.vm.getProgress();
        }
        , btn2: function (index, layero) {
          //按钮【按钮二】的回调
          //return false 开启该代码可禁止点击该按钮关闭
        }
      };

      top.f_layer_open_get("/admin/html/dataManagement/expexcel-getpro.html?tableId="+item.custom_data_zygl_id, "60%", "50%", function () {

      }, btn, "数据导出")
    },
    async exe_ClearData(item){
      let listother = {};
      try {
        copy(top.data.treeNodeObj,listother);
        listother["parentData"] = window.parent.vm.formInline;
        listother["other"] = window.parent.vm.other;
        listother["parmsData"] = this.parmsData;
        copy({ids:top.data.param.ids},listother);
      }catch (e){}
      let parm = {
        orderBy: item.mapzygl.order_col,
        tableId: item.mapzygl.id,
        searchInputDtos: _this.searchInputDtos,
        other: listother,
        pageNumber:""+_this.pageNumber,
        pageSize : ""+_this.pageSize
      }
      let i = load();
      const res = await postBody("/admin/api/DataManagementController/ClearData",parm);
      layer.close(i);
      top.alert(res.msg);
      if(res.code == 0){
        return;
      }
      _this.getListdata();
    },
    //清除数据
    async f_ClearData(item){
      layer.confirm('确定要清除当前数据操作吗？', {
        btn: ['确定', '取消'] //可以无限个按钮
      }, function (index, layero) {
        layer.close(index);
        _this.exe_ClearData(item);
      }, function (index) {
        //按钮【按钮二】的回调
      });
    },
    async f_save_list_data_table(item){
      let ids = _this.multipleSelection;

      let paramids = "";
      if(undefined != top.data.param){
        paramids = top.data.param.ids;
      }
      let other = {
        ids: "" + paramids,
        treeNode: top.data.treeNodeObj,
        tableId: item.mapzygl.id,
        input_id:item.mapzygl.input_id,
        listother:top.data.listother,
        type:"add",
        parentData:window.parent.vm.formInline
      }
      let i = load();
      postBody("/admin/api/DataManagementController/saveListData", {
        tableId: item.mapzygl.id,
        mapdata: {data:_this.tableData,selectData:_this.selectData},
        other: other
      }, function (res) {
        if(res.data != undefined){
          _this.dataid = res.data.id;
        }
        layer.close(i);
        top.alert(res.msg);
        _this.getListdata();
      })
    },
    //保存当前列表表格数据
    async f_save_list_data(item){
      if(item.is_confirm == "1"){
        layer.confirm('确定要执行此操作吗？', {
          btn: ['确定', '取消'] //可以无限个按钮
        }, function (index, layero) {
          layer.close(index);
          _this.f_save_list_data_table(item);
        }, function (index) {
          //按钮【按钮二】的回调
        });
      }else {
        _this.f_save_list_data_table(item);
      }
    },
    async f_add_action(data,item){
      let ids = _this.multipleSelection;
      let other = {
        ids: "" + top.data.param.ids,
        treeNode: top.data.treeNodeObj,
        tableId: item.mapzygl.id,
        input_id:item.mapzygl.input_id,
        listother:top.data.listother,
        type:"add",
        tableData:_this.tableData,
        selectData:_this.selectData,
        parentData:window.parent.vm.formInline,
        selectIds:""+ids
      }
      let i = top.load();
      const res = await postBody("/admin/api/DataManagementController/add", {
        tableId: item.mapzygl.id,
        mapdata: data,
        other: other
      });
      if(res.data != undefined){
        _this.dataid = res.data.id;
      }
      top.layer.close(i);
      top.alert(res);
      if(res.code == 1){
        _this.getListdata();
      }

    },
    async f_add_vue(item){
      let ids = _this.multipleSelection;
      let width = item.mapzygl.input_width;
      let height = item.mapzygl.input_height;
      let title = item.mapzygl.name;
      let input_url = item.mapzygl.url;
      let inline = false;
      if(input_url == "inputInline.vue"){
        inline = true;
      }
      top.openDialog({
        tableId:getTableId(item.mapzygl.id),
        title:title,
        width:width,
        height:height,
        inline:inline,
        id:""+ids,
        call:function (data,m){
          _this.f_add_action(data,item);
        }
      });
    },
    async f_add(item) {
      let ids = _this.multipleSelection;

      let other = {
        ids: "" + top.data.param.ids,
        treeNode: top.data.treeNodeObj,
        tableId: item.mapzygl.id,
        input_id:item.mapzygl.input_id,
        listother:top.data.listother,
        type:"add",
        tableData:_this.tableData,
        selectData:_this.selectData,
        parentData:window.parent.vm.formInline
      }
      top.data.other = other;
      top.data.param = other;
      top.data.buttonsItem = item.mapzygl;


      let input_url_v = item.mapzygl.url;
      if(input_url_v.indexOf(".vue") != -1){
        _this.f_add_vue(item);
        return;
      }

      let btn = {
        btn: ['保存并新增', '保存','关闭']
        , yes: function (index, layero) {
          console.log(layero);
          //按钮【按钮一】的回调
          var win = getTopIframe(layero);
          let issubmit = win.verification();
          if (!issubmit) {
            return false;
          }
          let data = win.getData();
          // data.id = "";
          let i = top.layer.load();
          other.type = "add";
          postBody("/admin/api/DataManagementController/add", {
            tableId: item.mapzygl.id,
            mapdata: data,
            other: other
          },async function (res) {
            if(res.data != undefined){
              _this.dataid = res.data.id;
            }

            top.layer.close(i);
            top.alert(res.msg);
            if(res.code == 1){
              //把当前新增的数据ID赋值到录入界面中
              win.vm.setUUIDInput(res.data.id);
            }

          })
        }
        , btn2: function (index, layero) {
          console.log("保存按钮");
          let win = getTopIframe(layero);
          let issubmit = win.verification();
          if (!issubmit) {
            return false;
          }
          let data = win.getData();
          let i = top.layer.load();
          let purl = "/admin/api/DataManagementController/add";
          /*if(_this.dataid != ""){
              purl = "/admin/api/DataManagementController/update";
              data.id = _this.dataid;
              for (let o in data) { // 遍历对象 fon in 循环 o 为 对象的属性名
                  let str = JSON.stringify(data[o]);
                  if (str.substring(0, 1) != '[') {
                      data[o]["id"] = _this.dataid;
                  }
              }
          }*/
          other.type = "saveUpdate";
          postBody(purl, {
            tableId: item.mapzygl.id,
            mapdata: data,
            other: other
          }, function (res) {
            if(res.data != undefined){
              _this.dataid = res.data.id;
            }

            top.layer.close(i);
            top.alert(res.msg);
            if(res.code == 1){
              //把当前新增的数据ID赋值到录入界面中
              win.vm.setUUIDInput(res.data.id);
            }
          })
          //按钮【按钮二】的回调
          return false;//开启该代码可禁止点击该按钮关闭
        },btn3:function (index,layero){
          console.log("关闭按钮");
        }
      };

      let inputurl = "/admin/html/dataManagement/input.html";
      if (item.mapzygl.url != "") {
        top.data.tableId = item.custom_data_zygl_id;
        inputurl = item.mapzygl.url;
      }else {
        if(item.is_input == "1"){
          inputurl = "/admin/html/dataManagement/input.html";
        }
        if(item.is_input == "2"){
          top.data.zygl_id = item.custom_data_zygl_id;
          top.data.tableId = item.custom_data_zygl_id;
          top.data.orderCol = "id";
          inputurl = "/admin/html/dataManagement/list.html";
        }
        if(item.mapzygl.input_id != ""){
          top.data.zygl_id = item.custom_data_zygl_id;
          top.data.tableId = item.custom_data_zygl_id;
          inputurl = "/admin/html/inputCustom/index.html?tableId="+item.custom_data_zygl_id;
        }
      }

      top.data.input_id = item.mapzygl.input_id;
      let width = item.mapzygl.input_width;
      let height = item.mapzygl.input_height;
      const resq = await postBody("/admin/api/DataManagementController/queryDataForId",{tableId: item.mapzygl.id,other: other,ids:""+ids});
      if(resq.code == 0){
        top.alert(resq.msg);
        return;
      }
      let title = item.mapzygl.name+"-新增"
      top.f_layer_open_get(inputurl, width, height, function () {
        _this.getListdata();
      }, btn, title, resq.data);
    }
    ,f_view(ids,item){
      let tableId = _this.tableId;
      if(item != undefined){
        tableId = item.custom_data_zygl_id;
      }
      ids = ""+ids;
      let parmids = "";
      if(undefined != top.data.param){
        parmids = top.data.param.ids;
      }
      let other = {
        ids: "" +parmids,
        treeNode: top.data.treeNodeObj,
        tableId: tableId,
        input_id:"",
        listother:top.data.listother,
        type:"view"
      }

      top.data.other = other;
      top.data.param = other;
      if(top.data.buttonsItem != undefined){
        top.data.buttonsItem.id = _this.tableId;
      }
      postBody("/admin/api/DataManagementController/queryDataForId", {
        ids: ""+ids,
        tableId: tableId,
        other: other
      }, function (res) {
        let btn = {
          btn: ['关闭']
          , btn2: function (index, layero) {
            //按钮【按钮二】的回调
            //return false 开启该代码可禁止点击该按钮关闭
          }
        };
        let item = JSON.parse(res.msg);
        let inputurl = "/admin/html/dataManagement/input.html";
        if (item.url != "") {
          inputurl = item.url;
        }else {
          if(item.is_input == "1"){
            top.data.zygl_id = tableId;
            inputurl = "/admin/html/dataManagement/input.html";
          }
          if(item.is_input == "2"){
            top.data.zygl_id = tableId;
            top.data.tableId = tableId;
            top.data.orderCol = "id";
            inputurl = "/admin/html/dataManagement/list.html";
          }
          if(item.input_id != ""){
            top.data.zygl_id = tableId;
            top.data.tableId = tableId;
            inputurl = "/admin/html/inputCustom/index.html?id="+ids;
          }
        }

        top.data.input_id = item.input_id;
        let width = item.input_width;
        let height = item.input_height;
        if(res.code == 0){
          top.error(res.msg);
          return;
        }
        let title = item.name+"-查看详情";
        top.f_layer_open_get(inputurl, width, height, function () {

        }, btn, title, res.data);
      })
    },
    async f_update_action(data,item,ids){
      let other = {
        ids: "" + top.data.param.ids,
        treeNode: top.data.treeNodeObj,
        tableId: item.mapzygl.id,
        input_id:item.mapzygl.input_id,
        listother:top.data.listother,
        type:"update"
      }
      let mapdatasubmit = data;
      mapdatasubmit.id = ids;
      let i = top.layer.load();
      const res = await postBody("/admin/api/DataManagementController/update", {
        tableId: item.custom_data_zygl_id,
        mapdata: mapdatasubmit,
        other: other
      });
      top.layer.close(i);
      top.alert(res);
      if(res.code == 1){
        _this.getListdata();
      }
    },
    async f_update_vue(item,ids){
      let width = item.mapzygl.input_width;
      let height = item.mapzygl.input_height;
      let title = item.mapzygl.name;
      let input_url = item.mapzygl.url;
      let inline = false;
      if(input_url == "inputInline.vue"){
        inline = true;
      }
      top.openDialog({
        tableId:getTableId(item.mapzygl.id),
        title:title,
        width:width,
        height:height,
        inline:inline,
        id:""+ids,
        call:function (data,m){
          _this.f_update_action(data,item,ids);
        }
      });
    }
    ,f_upex(item,ids){
      ids = ""+ids;
      let other = {
        ids: "" + top.data.param.ids,
        treeNode: top.data.treeNodeObj,
        tableId: item.mapzygl.id,
        input_id:item.mapzygl.input_id,
        listother:top.data.listother,
        type:"update"
      }

      top.data.other = other;
      top.data.param = other;
      top.data.buttonsItem = item.mapzygl;
      let input_url_v = item.mapzygl.url;
      if(input_url_v.indexOf(".vue") != -1){
        _this.f_update_vue(item,ids);
        return ;
      }
      postBody("/admin/api/DataManagementController/queryDataForId", {
        ids: ids,
        tableId: item.custom_data_zygl_id,
        other: other
      }, function (res) {
        let btn = {
          btn: ['确定', '取消']
          , yes: function (index, layero) {
            console.log(layero);
            //按钮【按钮一】的回调
            var win = getTopIframe(layero);
            let issubmit = win.verification();
            if (!issubmit) {
              return;
            }
            let data = win.getData();
            let mapdatasubmit = data;
            mapdatasubmit.id = ids;
            let i = top.layer.load();
            postBody("/admin/api/DataManagementController/update", {
              tableId: item.custom_data_zygl_id,
              mapdata: mapdatasubmit,
              other: other
            }, function (res) {
              top.layer.close(i);
              top.alert(res.msg);
              _this.getListdata();
            })
          }
          , btn2: function (index, layero) {
            //按钮【按钮二】的回调
            //return false 开启该代码可禁止点击该按钮关闭
          }
        };
        let inputurl = "/admin/html/dataManagement/input.html";
        if (item.mapzygl.url != "") {
          top.data.tableId = item.custom_data_zygl_id;
          inputurl = item.mapzygl.url;
        }else {
          if(item.is_input == "1"){
            inputurl = "/admin/html/dataManagement/input.html";
          }
          if(item.is_input == "2"){
            top.data.zygl_id = item.custom_data_zygl_id;
            top.data.tableId = item.custom_data_zygl_id;
            top.data.orderCol = "id";
            inputurl = "/admin/html/dataManagement/list.html";
          }
          if(item.mapzygl.input_id != ""){
            top.data.zygl_id = item.custom_data_zygl_id;
            top.data.tableId = item.custom_data_zygl_id;
            inputurl = "/admin/html/inputCustom/index.html?id="+ids;
          }
        }

        top.data.input_id = item.mapzygl.input_id;
        let width = item.mapzygl.input_width;
        let height = item.mapzygl.input_height;
        if(res.code == 0){
          top.error(res.msg);
          return;
        }
        // res.data.other = other;
        let title = item.mapzygl.name+"-修改"
        top.f_layer_open_get(inputurl, width, height, function () {

        }, btn, title, res.data);
      })
    }
    , f_update(item) {
      if (_this.multipleSelection.length != 1) {
        top.alert("只能选择一条记录进行修改");
        return;
      }
      let ids = _this.multipleSelection;
      _this.f_upex(item,ids);
    },
    f_delete_rows(item,ids){
      layer.confirm('确定要永久删除吗？', {
        btn: ['确定', '取消'] //可以无限个按钮
      }, function (index, layero) {
        let other = {
          ids: "" + top.data.param.ids,
          treeNode: top.data.treeNodeObj,
          tableId: item.mapzygl.id,
          listother:top.data.listother
        }
        top.data.other = other;
        postBody("/admin/api/DataManagementController/delete", {
          ids: "" + ids,
          tableId: item.mapzygl.id,
          other: other
        }, function (res) {
          top.alert(res.msg);
          _this.getListdata();
          layer.close(index);
        })
      }, function (index) {
        //按钮【按钮二】的回调
      });
    }
    , f_delete(item) {
      if (_this.multipleSelection.length == 0) {
        top.alert("请选择记录进行删除");
        return;
      }
      let ids = _this.multipleSelection;
      _this.f_delete_rows(item,ids);
    },
    f_post_confirm_rows(item,ids){
      if(item.is_confirm == "1"){
        layer.confirm('确定要执行此操作吗？', {
          btn: ['确定', '取消'] //可以无限个按钮
        }, function (index, layero) {
          layer.close(index);
          _this.f_post_rows(item,ids);
        }, function (index) {
          //按钮【按钮二】的回调
        });
      }else {
        _this.f_post_rows(item,ids);
      }

    },
    f_post_confirm(item){
      if(item.is_confirm == "1"){
        layer.confirm('确定要执行此操作吗？', {
          btn: ['确定', '取消'] //可以无限个按钮
        }, function (index, layero) {
          layer.close(index);
          _this.f_post(item);
        }, function (index) {
          //按钮【按钮二】的回调
        });
      }else {
        _this.f_post(item);
      }

    }
    , f_post_rows(item,ids) {//自定义数据接口
      top.data.buttonsItem = item.mapzygl;
      if (item.is_input != 0) {
        top.data.zygl_id = item.custom_data_zygl_id;
        let param = {
          treeNode: top.data.treeNodeObj,
          ids: "" + ids,
          tableId: item.custom_data_zygl_id,
          mapdata:{searchInputDtos:_this.searchInputDtos,tableData:_this.tableData}
        }
        top.data.param = param;
        let i = top.load();
        postBody("/admin/api/DataManagementController/customGetFormData", param, function (res) {
          top.layer.close(i);
          if(res.code == "0"){
            top.alert(res.msg);
            return ;
          }

          let btn = {
            btn: ['确定', '取消']
            , yes: function (index, layero) {
              //按钮【按钮一】的回调
              var win = getTopIframe(layero);
              let issubmit = win.verification();
              if (!issubmit) {
                return;
              }
              let data = win.getData();
              top.data.listother.parentData = {};
              data.listother = top.data.listother;
              data["searchInputDtos"] = _this.searchInputDtos;
              let i = top.layer.load();
              let psubmit = {
                treeNode: top.data.treeNodeObj,
                ids: "" + ids,
                tableId: item.custom_data_zygl_id,
                mapdata: data
              }
              top.data.param = param;
              postBody("/admin/api/DataManagementController/customPostData", psubmit, function (res) {
                top.layer.close(i);
                top.alert(res.msg);
                _this.getListdata();
              })
            }
            , btn2: function (index, layero) {
              //按钮【按钮二】的回调
              //return false 开启该代码可禁止点击该按钮关闭
            }
          };
          let openurl = item.mapzygl.url;
          if (openurl == "") {
            if(item.is_input == "1"){
              openurl = "/admin/html/dataManagement/input.html";
            }
            if(item.is_input == "2"){
              top.data.zygl_id = item.custom_data_zygl_id;
              top.data.tableId = item.custom_data_zygl_id;
              top.data.orderCol = "id";
              openurl = "/admin/html/dataManagement/list.html";
            }

          }

          if(item.mapzygl.input_id != ""){
            if(openurl == "/admin/html/dataManagement/input.html" || openurl == ""){
              openurl = "/admin/html/inputCustom/index.html";
            }
            top.data.zygl_id = item.custom_data_zygl_id;
            top.data.tableId = item.custom_data_zygl_id;
            console.log("inputid",top.data.tableId)
          }

          top.data.input_id = item.mapzygl.input_id;
          let width = item.mapzygl.input_width;
          let height = item.mapzygl.input_height;
          let title = item.mapzygl.name;
          top.f_layer_open_get(openurl, width, height, function () {
            top.data.zygl_id = top.data.tableId;
          }, btn, title, res.data);
        })

      } else {
        let psubmit = {
          treeNode: top.data.treeNodeObj,
          ids: "" + ids,
          tableId: item.custom_data_zygl_id,
          mapdata:{searchInputDtos:_this.searchInputDtos,tableData:_this.tableData}
        }
        let i = top.layer.load();
        postBody("/admin/api/DataManagementController/customPostData", psubmit, function (res) {
          top.layer.close(i);
          top.alert(res.msg);
          _this.getListdata();
        })
      }
    },
    getParentData(){
      try {
        let pmapdata = window.parent.vm.formInline;
        if(pmapdata == undefined){
          return {};
        }
        return window.parent.vm.formInline;
      }catch (e){
        return {};
      }
    },
    async f_post_action(data,item){
      var ids = _this.multipleSelection;
      top.data.buttonsItem = item.mapzygl;
      let listother = {};
      try {
        copy(top.data.treeNodeObj,listother);
        copy({ids:top.data.param.ids},listother);
        listother["parentData"] = _this.getParentData();
        listother["other"] = window.parent.vm.other;
      }catch (e){}
      data.listother = listother;
      data["searchInputDtos"] = _this.searchInputDtos;
      data["parentData"] = _this.getParentData();

      let psubmit = {
        treeNode: top.data.treeNodeObj,
        ids: "" + ids,
        tableId: item.custom_data_zygl_id,
        mapdata: data
      }
      let i = top.load();
      const res = await postBody("/admin/api/DataManagementController/customPostData", psubmit);
      top.layer.close(i);
      top.alert(res);
      if(res.code == 1){
        _this.getListdata();
      }
    },
    f_post_opendialog(item){//自定义数据接口
      let width = item.mapzygl.input_width;
      let height = item.mapzygl.input_height;
      let title = item.mapzygl.name;
      let input_url = item.mapzygl.url;
      let inline = false;
      if(input_url == "inputInline.vue"){
        inline = true;
      }
      top.openDialog({
        tableId:getTableId(item.mapzygl.id),
        title:title,
        width:width,
        height:height,
        inline:inline,
        call:function (data,m){
          _this.f_post_action(data,item);
        }
      });
    }
    , f_post(item) {//自定义数据接口
      var ids = _this.multipleSelection;
      top.data.buttonsItem = item.mapzygl;
      let listother = {};
      try {
        copy(top.data.treeNodeObj,listother);
        copy({ids:top.data.param.ids},listother);
        listother["parentData"] = _this.getParentData();
        listother["other"] = window.parent.vm.other;
      }catch (e){}

      if (item.is_input != 0) {
        top.data.zygl_id = item.custom_data_zygl_id;
        let param = {
          treeNode: top.data.treeNodeObj,
          ids: "" + ids,
          tableId: item.custom_data_zygl_id,
          mapdata:{searchInputDtos:_this.searchInputDtos,tableData:_this.tableData,other:listother}
        }
        top.data.param = param;
        //查询是否为elementui弹框
        let ourl = item.mapzygl.url;
        if(ourl.indexOf(".vue") != -1){
          _this.f_post_opendialog(item);
          return ;
        }


        let i = top.load();
        postBody("/admin/api/DataManagementController/customGetFormData", param, function (res) {
          top.layer.close(i);
          if(res.code == "0"){
            top.alert(res.msg);
            return ;
          }

          let btn = {
            btn: ['确定', '取消']
            , yes: function (index, layero) {
              //按钮【按钮一】的回调
              var win = getTopIframe(layero);
              let issubmit = win.verification();
              if (!issubmit) {
                return;
              }
              let data = win.getData();
              data.listother = listother;
              console.log("data.listother",data.listother);
              data["searchInputDtos"] = _this.searchInputDtos;
              data["parentData"] = _this.getParentData();
              let i = top.layer.load();
              let psubmit = {
                treeNode: top.data.treeNodeObj,
                ids: "" + ids,
                tableId: item.custom_data_zygl_id,
                mapdata: data
              }
              top.data.param = param;
              postBody("/admin/api/DataManagementController/customPostData", psubmit, function (res) {
                top.layer.close(i);
                top.alert(res);
                if(res.code == 1){
                  _this.getListdata();
                }
              })
            }
            , btn2: function (index, layero) {
              //按钮【按钮二】的回调
              //return false 开启该代码可禁止点击该按钮关闭
            }
          };
          let openurl = item.mapzygl.url;
          if (openurl == "") {
            if(item.is_input == "1"){
              openurl = "/admin/html/dataManagement/input.html";
            }
            if(item.is_input == "2"){
              top.data.zygl_id = item.custom_data_zygl_id;
              top.data.tableId = item.custom_data_zygl_id;
              top.data.orderCol = "id";
              openurl = "/admin/html/dataManagement/list.html";
            }

          }

          if(item.mapzygl.input_id != "" && item.is_input != "2"){
            if(openurl == "/admin/html/dataManagement/input.html"){
              openurl = "/admin/html/inputCustom/index.html";
            }
            top.data.zygl_id = item.custom_data_zygl_id;
            top.data.tableId = item.custom_data_zygl_id;
            console.log("inputid",top.data.tableId)
          }

          top.data.input_id = item.mapzygl.input_id;
          let width = item.mapzygl.input_width;
          let height = item.mapzygl.input_height;
          let title = item.mapzygl.name;
          top.f_layer_open_get(openurl, width, height, function () {
            top.data.zygl_id = top.data.tableId;
          }, btn, title, res.data);
        })

      } else {
        let psubmit = {
          treeNode: top.data.treeNodeObj,
          ids: "" + ids,
          tableId: item.custom_data_zygl_id,
          mapdata:{searchInputDtos:_this.searchInputDtos,tableData:_this.tableData,other:listother,parentData : _this.getParentData()}
        }
        let i = top.layer.load();
        postBody("/admin/api/DataManagementController/customPostData", psubmit, function (res) {
          top.layer.close(i);
          top.alert(res.msg);
          _this.getListdata();
        })
      }
    }

  },
  watch:{
    chooseArr(data){
      _this.selectRow = [];
      if (data.length > 0) {
        data.forEach((item, index) => {
          _this.selectRow.push(_this.tableData.indexOf(item));
        });
      }
    }
  }
};
</script>


